package org.example.review.config;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.logging.Logger;

@SpringBootApplication
@MapperScan("org.example.review.mapper")
public class TestApplication {

    private static final Logger logger = Logger.getLogger(TestApplication.class.getName());

    public static void main(String[] args) {
        try {
            logger.info("开始启动测试应用程序...");

            ConfigurableApplicationContext context = SpringApplication.run(TestApplication.class, args);

            logger.info("应用程序启动成功！");
            logger.info("活动Profile: " + String.join(", ", context.getEnvironment().getActiveProfiles()));
            logger.info("服务端口: " + context.getEnvironment().getProperty("server.port", "8080"));
            logger.info("数据源URL: " + context.getEnvironment().getProperty("spring.datasource.url"));

        } catch (Exception e) {
            logger.severe("应用程序启动失败: " + e.getMessage());
            e.printStackTrace();
        }
    }
}